﻿using Kingdee.BOS;
using Kingdee.BOS.App.Data;
using Kingdee.BOS.Contracts.Report;
using Kingdee.BOS.Core.Report;
using Kingdee.BOS.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Kingdee.BOS.Core.Enums.BOSEnums;

namespace DzInfo.Report.BaiRan
{
    [Description("百燃：应收账龄分析报表_简单账表"), HotUpdate]
    public class SalYszlbb : SysReportBaseService
    {
        public override void Initialize()
        {
            base.Initialize();
            this.ReportProperty.ReportType = ReportType.REPORTTYPE_NORMAL;
            this.ReportProperty.ReportName = new LocaleValue("应收账龄分析报表", base.Context.UserLocale.LCID);
            this.IsCreateTempTableByPlugin = true;
            this.ReportProperty.IsUIDesignerColumns = false;
            this.ReportProperty.IsGroupSummary = true;
            this.ReportProperty.SimpleAllCols = false;
            this.ReportProperty.PrimaryKeyFieldName = "FNUMBER";
            this.ReportProperty.IdentityFieldName = "FIDENTITYID";
        }
        public override void BuilderReportSqlAndTempTable(IRptParams filter, string tableName)
        {
            List<SqlParam> sqlParams = new List<SqlParam>();
            sqlParams.Add(new SqlParam("@TempName", KDDbType.AnsiString, tableName));
            DBUtils.ExecuteStoreProcedure(this.Context, "P_BR_YSZLB", sqlParams);
        }
        public override ReportHeader GetReportHeaders(IRptParams filter)
        {
            ReportHeader header = new ReportHeader();
            header.AddChild("FNUMBER", new LocaleValue("客户编码"), SqlStorageType.Sqlnvarchar, visible: true);
            header.AddChild("FNAME", new LocaleValue("客户名称"), SqlStorageType.Sqlnvarchar, visible: true);
            header.AddChild("BB", new LocaleValue("结算币别"), SqlStorageType.Sqlnvarchar, visible: true);
            header.AddChild("ZHAOQI", new LocaleValue("超期金额"), SqlStorageType.SqlDecimal);
            header.AddChild("BENYUE", new LocaleValue("本月应收金额"), SqlStorageType.SqlDecimal);
            header.AddChild("XIAYUE", new LocaleValue("下月金额", 2052), SqlStorageType.SqlDecimal);
            header.AddChild("X2YUE", new LocaleValue("下2月金额", 2052), SqlStorageType.SqlDecimal);
            header.AddChild("X3YUE", new LocaleValue("下3月金额", 2052), SqlStorageType.SqlDecimal);
            header.AddChild("X4YUE", new LocaleValue("下4月金额", 2052), SqlStorageType.SqlDecimal);
            header.AddChild("X5YUE", new LocaleValue("下5月金额", 2052), SqlStorageType.SqlDecimal);
            header.AddChild("X6YUE", new LocaleValue("6月之后金额", 2052), SqlStorageType.SqlDecimal);
            return header;
        }
        //public override List<Kingdee.BOS.Core.Report.SummaryField> GetSummaryColumnInfo(IRptParams filter)
        //{
        //    var result = base.GetSummaryColumnInfo(filter);
        //    result.Add(new Kingdee.BOS.Core.Report.SummaryField("ZHAOQI", Enu_SummaryType.SUM));
        //    result.Add(new Kingdee.BOS.Core.Report.SummaryField("BENYUE", Enu_SummaryType.SUM));
        //    result.Add(new Kingdee.BOS.Core.Report.SummaryField("XIAYUE", Enu_SummaryType.SUM));
        //    result.Add(new Kingdee.BOS.Core.Report.SummaryField("X2YUE", Enu_SummaryType.SUM));
        //    result.Add(new Kingdee.BOS.Core.Report.SummaryField("X3YUE", Enu_SummaryType.SUM));
        //    result.Add(new Kingdee.BOS.Core.Report.SummaryField("X4YUE", Enu_SummaryType.SUM));
        //    result.Add(new Kingdee.BOS.Core.Report.SummaryField("X5YUE", Enu_SummaryType.SUM));
        //    result.Add(new Kingdee.BOS.Core.Report.SummaryField("X6YUE", Enu_SummaryType.SUM));
        //    return result;
        //}
    }
}
